RTECO-858: Add JFrog CLI Task support for Bamboo Deployment Projects#231
Conversation
The JFrog CLI task was available in build plans but invisible in Deployment Project task pickers because it did not implement DeploymentTaskType. Add a full deployment-project variant of the JFrog CLI task: - ArtifactoryDeploymentJfrogCliTask: extends ArtifactoryDeploymentTaskType (which implements DeploymentTaskType), runs any user-supplied `jf` command as a subprocess, injecting JF_URL / JF_USER / JF_PASSWORD from the selected server configuration so credentials never need to be embedded in the command. - JfrogCliDeploymentContext: config key constants and typed getters. - JfrogCliDeploymentConfiguration: task configurator for the create/edit UI. - editJfrogCliDeploymentTask.ftl: UI template with server dropdown and free-form command textarea. - atlassian-plugin.xml: registers the new taskType with category "deployment". - i18n-jfrog.properties: adds labels and help text for the new task. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
atlassian-plugin.xml registers two non-existent classes (ArtifactoryDeploymentPublishBuildInfoTask, ArtifactoryDeploymentXrayScanTask)
The diff includes registrations for these two task types, but neither class exists in this PR or anywhere in the codebase. This can cause the plugin to fail to load at startup in Bamboo.
These registrations appear to be leftover/accidental and should be removed (or the classes need to be added — but the PR description makes no mention of them).
There was a problem hiding this comment.
Addressed it.
| } catch (IOException | InterruptedException e) { | ||
| buildInfoLog.error("Exception while running JFrog CLI command: " + e.getMessage(), e); | ||
| return TaskResultBuilder.newBuilder(deploymentTaskContext).failedWithError().build(); |
There was a problem hiding this comment.
InterruptedException swallowed without restoring interrupt status
There was a problem hiding this comment.
Addressed it.
| return StringUtils.trimToEmpty(env.get(JF_COMMAND)); | ||
| } | ||
|
|
||
| public static Set<String> getFieldsToCopy() { |
There was a problem hiding this comment.
getFieldsToCopy() allocates a new HashSet on every call.
Should be a static constant: private static final Set FIELDS_TO_COPY = Set.of(SERVER_ID, JF_COMMAND);
There was a problem hiding this comment.
Addressed it.
- atlassian-plugin.xml: remove leftover taskType registrations for ArtifactoryDeploymentPublishBuildInfoTask and ArtifactoryDeploymentXrayScanTask. Those classes are not part of this PR and would have caused the plugin to fail to load at startup in Bamboo. - ArtifactoryDeploymentJfrogCliTask: split the catch block so InterruptedException restores the thread's interrupt status (Thread.currentThread().interrupt()) before failing the task, instead of being silently swallowed. - JfrogCliDeploymentContext: hoist the field-name set into a static final Set.of(...) constant so getFieldsToCopy() no longer allocates a new HashSet on every invocation. Co-authored-by: Cursor <cursoragent@cursor.com>
Expands the JFrog CLI deployment task work to also restore the deployment-project variants of "Artifactory Publish Build Info" and "Artifactory Xray Scan", which were previously only available in build plans. The two task class registrations in atlassian-plugin.xml had no corresponding Java implementations; this commit adds them. - ArtifactoryDeploymentPublishBuildInfoTask: extends ArtifactoryDeploymentTaskType so it implements DeploymentTaskType and appears in the Deployment Project task picker. Publishes a minimal BuildInfo (name/number/started date) to Artifactory using the selected server configuration. - ArtifactoryDeploymentXrayScanTask: deployment-project variant that triggers a JFrog Xray scan for a previously published build and fails the deployment when the scan reports vulnerabilities (when failIfVulnerable is set). - ArtifactoryBuildContext: add getBuildName()/getBuildNumber() helpers that read directly from the configuration map. Required because a DeploymentTaskContext does not provide a BuildContext from which the build-time tasks normally pull these values. - atlassian-plugin.xml: re-register the two task types alongside the JFrog CLI task. Both reuse their build-time variants' configuration classes and FTL templates, since the configuration shape is identical. Co-authored-by: Cursor <cursoragent@cursor.com>
The JFrog CLI task was available in build plans but invisible in Deployment Project task pickers because it did not implement DeploymentTaskType.
Add a full deployment-project variant of the JFrog CLI task:
jfcommand as a subprocess, injecting JF_URL / JF_USER / JF_PASSWORD from the selected server configuration so credentials never need to be embedded in the command.